//package com.demo.ai.config;
//
//import org.springframework.ai.chat.ChatClient;
//import org.springframework.ai.chat.ChatClientBuilder;
//import org.springframework.ai.ollama.OllamaChatClient;
//import org.springframework.ai.ollama.api.OllamaApi;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import java.time.Duration;
//
//@Configuration
//public class ChatConfig {
//
//    @Bean
//    public ChatClientBuilder chatClientBuilder(OllamaApi ollamaApi) {
//        return ollamaApi.builder()
//            .withDefaultOptions(
//                OllamaChatClient.OllamaChatOptions.builder()
//                    .withModel("qwen3:4b")
//                    .withStreaming(true)
//                    .withTimeout(Duration.ofSeconds(60)) // 设置30秒流式超时
//                    .build()
//            );
//    }
//
//    @Bean
//    public ChatClient chatClient(ChatClientBuilder builder) {
//        return builder.build();
//    }
//
//}